#ifndef _CAN_MSG_H_
#define _CAN_MSG_H_



/******************* define of project *****************/
//#define CRCC
#define RV_DEMON
// #define SHANQI
#define LIL8  //li auto L8 car modify

/*******************************************************/


#define CAN_FRAMETYPE_NORMAL       0
#define CAN_FRAMETYPE_RTR          1	//canfd has no remote frames

#define CAN_TYPE_STANDARD        0
#define CAN_TYPE_EXTENDED        1

typedef enum 
{
    E_CAN = 1,
    E_CAN_FD,
} E_CAN_TYPE;

typedef enum 
{
    E_CAN_100K = 1,
    E_CAN_125K,
    E_CAN_200K,
    E_CAN_250K,
    E_CAN_400K,
    E_CAN_500K,
    E_CAN_800K,
    E_CAN_1000K,
} E_CAN_BAUDRATE;

/** Can message structure */
typedef struct {
  unsigned int uiCanId;		// l'ID du mesg
  char cIde;      			// can extend flag. 0 for sandard frame, 1 for extended frame
  char cRtr;				// remote transmission request. 0 if not rtr, 
                            // 1 for a rtr message
  char cLen;				// message length (0 to 8)
  char acData[8]; 			// data
} T_CAN_MSG;

int CAN_Init(const char *pcCanName, E_CAN_BAUDRATE iBaudrateIndex, E_CAN_TYPE iCanType);
int CAN_SetFilter(int iCanfd, int iCanId);
void CAN_Uninit(int iCanFd);
int CAN_SendMsg(int iCanFd, T_CAN_MSG *ptCanMsg);
int CAN_RecvMsg(int iCanFd, T_CAN_MSG *ptCanMsg);
int CAN_RecvMsgTimeout(int iCanFd, T_CAN_MSG *ptCanMsg, int ms);




#endif

